package com.example.subject10mvn.service;

import com.example.subject10mvn.entity.Subject;
import com.example.subject10mvn.vo.Pagination;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;


@CacheConfig(cacheNames = "subject")
public interface SubjectService {
    @Cacheable(key = "#pagination.toString()+#subjectTypeId.toString()")
    List<Subject> findAllWithPageAndSubjectTypeId(Pagination pagination, Integer subjectTypeId);

    @Cacheable
    String getFindAllDataTotal(Pagination pagination, Integer subjectTypeId);

    @Cacheable
    Subject getOne(Integer id);

    @CacheEvict(allEntries = true)
    void insertOne(Subject subject);

    @CacheEvict(allEntries = true)
    void deleteOne(Integer id);

    @CacheEvict(allEntries = true)
    void updateOne(Subject subject);
}
